const { sequelize } = require('../config/db');
const { DataTypes } = require('sequelize');

//定义路由模型
const functionsModels = sequelize.define('functions', {
  id: {
    type: DataTypes.INTEGER,
    primaryKey: true,
    autoIncrement: true
  },
  name: {
    type: DataTypes.STRING,
    allowNull: false,
    unique: false //使用了 unique: true，这也会自动创建唯一索引
  },
  icon: {
    type: DataTypes.STRING,
    allowNull: false,
    unique: false
  },
  page: {
    type: DataTypes.STRING,
    allowNull: false,
    unique: false
  },
},
  {
    tableName: 'functions',
    timestamps: true,
    indexes: []
  }
)

// 导出所有模型
module.exports = { functionsModels };